package main.java.com.lee.pool;

import java.util.concurrent.ThreadFactory;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Description TODO
 * @Author winston
 * @DateTime 2021/12/8
 */
public class MyThreadFactory implements ThreadFactory {

	static AtomicInteger threadNo = new AtomicInteger(1);
	@Override
	public Thread newThread(Runnable r) {
		String threadName = "my_thread_" + threadNo.incrementAndGet();
		Thread thread = new Thread(r, threadName);
		thread.setDaemon(false);
		return thread;
	}
}
